package com.pzl.controller.goods;

import com.alibaba.dubbo.config.annotation.Reference;
import com.pzl.entity.PageResult;
import com.pzl.pojo.goods.Brand;
import com.pzl.service.goods.BrandService;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * BrandController class
 *
 * @Author panzhenglei
 * @Date 2019/6/21 19:57
 */


@RestController
@RequestMapping("/brand")
public class BrandController {

    @Reference
    private BrandService brandService;

    @RequestMapping("/findAll")
    public List<Brand> findAll(){
        return brandService.findAll();
    }

    @GetMapping("/findPage")
    public PageResult<Brand> findPage(@RequestParam(required = true,defaultValue = "1") int page, @RequestParam(required = true,defaultValue = "10") int size){
        return brandService.fingPage(page,size);
    }

    @PostMapping("/findList")
    public List<Brand> findList(@RequestBody Map<String, Object> searchMap){
        return brandService.findList(searchMap);
    }

    @PostMapping("/findPage")
    public PageResult<Brand> findPage(@RequestBody Map searchMap,@RequestParam(required = true,defaultValue = "1") int page, @RequestParam(required = true,defaultValue = "10") int size){
        return brandService.fingPage(page,size,searchMap);
    }

    @GetMapping("/findById")
    public Brand findById(@RequestParam(required = true,defaultValue = "1115")int id){
        return brandService.findById(id);
    }
}
